<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreatePayStreamMappingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysqlOrderAll')->create('pay_stream_mappings', function (Blueprint $table) {
            $table->char('payNo', 32)->default('')->comment('我方 唯一支付流水号');
            $table->unsignedInteger('shopId')->default(0)->comment('');
            $table->unsignedTinyInteger('sysType')->default(1)->comment('业务类型');
            $table->string('bizId', 64)->default('')->comment('业务订单号');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');

            $table->primary('payNo', 'idx_payNo');
            $table->index('bizId', 'idx_bizId');
            $table->index('createdAt', 'idx_createdAt');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '支付流水映射表（仅包含堂食+券包流水）';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysqlOrderAll')->dropIfExists('pay_stream_mappings');
    }
}
